<?php

namespace apiend\modules\attach\controllers;

use Yii;
use apiend\components\Controller;
use apiend\modules\attach\models\AlbumSearch;
use apiend\modules\attach\models\RecentPictureSearch;

/**
 * 链接选择管理
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class LibraryController extends Controller {

    /**
     * 商城链接列表
     * @inheritdoc
     */
    public function actionIndex() {
        $recent = new RecentPictureSearch();
        $recent->pagesize = false;
        $recent->limitSize = 20;
        $recent->store_id = $this->storeId;
        $alumb = new AlbumSearch();
        $alumb->pagesize = false;
        $alumb->store_id = $this->storeId;
        return [
            'albums' => $alumb->search(),
            'recents' => $recent->search()
        ];
    }

    /**
     * 商城链接列表
     * @inheritdoc
     */
    public function actionView($id) {
        return MapLinkSearch::findByGroupName('PageLink');
    }

}
